Importing required libraries to predict acceleration using random forest, calculate RMSE (RootMeanSquaredError), and create plots to compare predicted and actual acceleration
import pandas as pd
import numpy as np
import FileProcessing
import ModelClass
original File path: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\scripts Data File path: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data
file=FileProcessing.FileProcessing()
model_obj=ModelClass.ModelClass()
delta_time=0.2
#timeSpans=[0.1,0.2,0.3,0.5,1,2,4]
timeSpans=[0.1]
file_name='Prediction_set_Predited_data_' +str(delta_time)
prediction_set=file.read_input(file_name)
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.2.csv
predict_on_pair=prediction_set["L-F_Pair"].unique()
for pair_number in predict_on_pair:
for delta_time in timeSpans:
file_name='Prediction_set_Predited_data_' +str(delta_time)
prediction_set=file.read_input(file_name)
print(f"Pair: {pair_number} , reaction time: {delta_time} Trajectories: ")
prediction_1 = prediction_set[prediction_set["L-F_Pair"]== pair_number]
model_obj.plot_all_predictions(prediction_1,delta_time)
print()
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.1.csv Pair: 2322-2330 , reaction time: 0.1 Trajectories:
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.1.csv Pair: 551-560 , reaction time: 0.1 Trajectories:
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.1.csv Pair: 1304-1309 , reaction time: 0.1 Trajectories:
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.1.csv Pair: 2785-2804 , reaction time: 0.1 Trajectories:
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.1.csv Pair: 3084-3094 , reaction time: 0.1 Trajectories:
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.1.csv Pair: 439-444 , reaction time: 0.1 Trajectories:
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.1.csv Pair: 2695-2725 , reaction time: 0.1 Trajectories:
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.1.csv Pair: 2725-2717 , reaction time: 0.1 Trajectories:
File Read Complete: C:\Users\StudentAccount\Python\capstone-bravo\DataDrivenCarFollowing\datadrivencarfollowing-v1\data/Prediction_set_Predited_data_0.1.csv Pair: 1635-1642 , reaction time: 0.1 Trajectories: